package com.softWang.system.po;

import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.softWang.common.base.BasePO;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
/**
 * 系统参数表
 */
@TableName(value = "system_parameter", autoResultMap = true)
@KeySequence("system_parameter_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库，可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SystemParameter extends BasePO {

    @ApiModelProperty(value = "主键id")
    @TableId
    private Long id;


    @ApiModelProperty(value = "名称，长度为60")
    @NotBlank(message = "pname不能为空")
    @Size(max = 60,message="pname长度为60")
    private String pname;


    @ApiModelProperty(value = "键，长度为60")
    @NotBlank(message = "pkey不能为空")
    @Size(max = 60,message="key长度为60")
    private String pkey;


    @ApiModelProperty(value = "值，长度为60")
    @NotBlank(message = "pvalue不能为空")
    @Size(max = 100,message="value长度为100")
    private String pvalue;


    @ApiModelProperty(value = "类型,{字符串:1,数值:2,布尔值:3}")
    @NotNull(message = "type不能为空")
    private Integer type;


    @ApiModelProperty(value = "状态,0:正常,1:停用")
    private Integer state;

    @ApiModelProperty(value = "备注")
    private String remark;


    /**
     * 状态枚举
     */
    public enum Type {
        /**
         * 字符串
         */
        String(1),
        /**
         * 数值
         */
        Number(2),
        /**
         * 布尔值
         */
        Boolean(3);


        private Integer code;

        Type(Integer code) {
            this.code = code;
        }
        public Integer getCode() {
            return this.code;
        }

    }

    /**
     * 状态枚举
     */
    public enum State {
        /**
         * 正常
         */
        NORMAL(0),
        /**
         * 停用
         */
        DISABLE(1);


        private Integer code;

        State(Integer code) {
            this.code = code;
        }
        public Integer getCode() {
            return this.code;
        }

    }


}